<?php // check for the user session 

			/*	session_start(); ?>
              <?php if(isset($_SESSION['user_id'])){
				  
				  header('Location: user-home.php'); } */
				  ?>

<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

	<title>Register</title>
	<meta name="description" content="">
	<meta name="author" content="">

	<meta name="viewport" content="width=device-width">

	<link rel="stylesheet" href="css/bootstrap.min.css">
	<style>
	body {
	  padding-top: 60px;
	  padding-bottom: 40px;
	}
	
	/*validation error styles
------------------------------------------------------------------*/
#msg {
	display:none; 
	position:absolute; 
	z-index:200; 
	background:url(images/msg_arrow.png) left center no-repeat; 
	padding-left:7px}
#msgcontent {display:block; background:#ffe5e5; border:2px solid #ff8b7b; border-left:none; padding:5px; min-width:150px; max-width:250px}

	
	</style>
	<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
	<link rel="stylesheet" href="css/style.css">
	<script type="text/javascript" src="js/libs/jquery-1.7.2.min.js"></script>
	<script src="js/libs/modernizr-2.5.3-respond-1.1.0.min.js"></script>
     <script src="js/registration.js"></script>
    <script type="text/javascript">

	var emailflag=1;
	
	
		
		function email_check(){	
		
		var email = $('#email').val();
	
	
			if(email!="")
			{
			$('#emailcheck').html('<img src="img/ajax-loader.gif" />');
			
				jQuery.ajax({
				   type: "POST",
				   url: "logic/checkuser.php",
				   data: 'email='+ email,
				   cache: false,
				   success: function(response){
				if(response ==0){
					
						$('#emailcheck').html("Email Address already registered");
						$('#emailcheck').css('color', 'red');
						$('#submit').attr('disabled', 'disabled');
						emailflag=1;
					
					}
					else if(response==1)
					{ 

						$('#emailcheck').html("Email Available");
						$('#emailcheck').css('color', 'green');
						$('#submit').removeAttr('disabled');
						emailflag=0;
					}
					
					else if(response==2){
						
						$('#emailcheck').html("Invalid Email Address");
						$('#emailcheck').css('color', 'red');
						$('#submit').attr('disabled', 'disabled');
						emailflag=1;
						 
					}
					
				}
				
				
				});
			}
	}

	
	
</script>
</head>
<body>
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->

    <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="index.php">E-library</a>
          <div class="nav-collapse">
            <ul class="nav">
              <li><a href="index.php">Home</a></li>
				  <li  class="active"><a href="register.php">Register</a></li>
				  <li><a href="login.php">Log In</a></li>
			 
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container">

      
        
      
      <form id="registration" class=" well" onSubmit="return validate(this)" action="logic/registration.php" method="post">
      
      	<h2>Register</h2>
        
     
        <br>
            
            <div class="span4">
            	<p><label for="name" >Name</label>
        		<input type="text" tabindex="1" class="required input-xlarge" name="name" id="name" placeholder=""></p>
        
        		<p><label for="password" >Password</label> <input tabindex="4" class="required " type="password" name="password" id="password" ></p>
                <p> <label for="city" >City</label> <input class="required " tabindex="7" type="text" name="city" id="city" ></p>
                
                 <p> <label for="pincode" >Pincode</label> <input tabindex="10" class="required input-small" type="number" name="pincode" id="pincode" ></p>
                 
                 <p><input type="submit" tabindex="12" id="submit" class="btn btn-primary btn-large" value="Register"/></p>
                 
            </div>
            <div class="span4">
            	<p><label for="email" >Email</label>
       			<input type="email" tabindex="2" class="required input-xlarge" name="email" id="email" placeholder="ex: valid@email.com" onBlur="email_check()"><label id="emailcheck"></label></p> 
       
       			 <p><label for="c_password" >Confirm Password</label> <input tabindex="5" class="required " type="password" name="c_password" id="c_password"></p>
                 
                  <p> <label for="state" >State</label> <input tabindex="8" class="required input-large" type="text" name="state" id="state" ></p>
                  
                  <?php 
					$no1 = rand(0,100);
					$no2 = rand(0,100);
					$no3 = $no1 + $no2;
				?>
			   
					<p>
					<!--this is captcha logic-->
					<label for="captcha">Provide the value of : <?php echo $no1 ?> + <?php echo $no2 ?> </label>
					<input type="hidden" name="answer" id="answer" value="<?php echo $no3?>" >
					<input type="text" name="captcha" tabindex="11" id="captcha" value="" class="input-small required" >
					</p>
                  
            </div>
            <div class="span3">
            	<p><label for="contact" >Mobile No.</label> <input class="required " tabindex="3" type="text" name="contact" id="contact" ></p>
                <p> <label for="address" >Address</label><textarea id="address" tabindex="6" name="address"></textarea></p>
                
                 <p> <label for="country" >Country</label> <input class="required " type="text" tabindex="9" name="country" id="country" ></p>
            </div>
            
        <div class="clearfix"></div>
 
      </form>
     


      <hr>

      <footer>
        <p>&copy; Company 2012</p>
      </footer>

	

    </div> <!-- /container -->
   
    


</body>
</html>
